Remove GDestroyNotify casts in g_clear_pointer() uses
authorErnestas Kulik <ernestask@gnome.org>
Wed, 25 Jul 2018 07:00:09 +0000 (10:00 +0300)
committerErnestas Kulik <ernestask@gnome.org>
Wed, 25 Jul 2018 07:05:39 +0000 (10:05 +0300)
GLib master propagates argument types in g_clear_pointer(), which causes
the usual function pointer casts to GDestroyNotify to trip compiler
warnings. Additionally, this commit changes some cleanup functions where
appropriate (wl_data_source_destroy ->
gtk_primary_selection_source_destroy for struct
gtk_primary_selection_source).

gdk/wayland/gdkclipboard-wayland.c
gdk/wayland/gdkdevice-wayland.c
gdk/wayland/gdkdrag-wayland.c
gdk/wayland/gdkdrop-wayland.c
gdk/wayland/gdkprimary-wayland.c
gtk/gtkdnd.c
gtk/gtkscrolledwindow.c

index 25671ff6703116bd331a604fb0974f2873663a5a..bed53a71aad5b32c0b701bc0af0b30b7febac507 100644 (file)
@@ -52,13 +52,13 @@ static void
 gdk_wayland_clipboard_discard_offer (GdkWaylandClipboard *cb)
 {
   g_clear_pointer (&cb->offer_formats, gdk_content_formats_unref);
-  g_clear_pointer (&cb->offer, (GDestroyNotify) wl_data_offer_destroy);
+  g_clear_pointer (&cb->offer, wl_data_offer_destroy);
 }
 
 static void
 gdk_wayland_clipboard_discard_source (GdkWaylandClipboard *cb)
 {
-  g_clear_pointer (&cb->source, (GDestroyNotify) wl_data_source_destroy);
+  g_clear_pointer (&cb->source, wl_data_source_destroy);
 }
 
 static void
index 546d600ff89962f04b8a7b27b038bc465e5b0758..2b7557a63f27756c70c931ead8886db37e0cbc0b 100644 (file)
@@ -1087,7 +1087,7 @@ gdk_wayland_seat_discard_pending_offer (GdkWaylandSeat *seat)
       gdk_content_formats_unref (ignore);
       seat->pending_builder = NULL;
     }
-  g_clear_pointer (&seat->pending_offer, (GDestroyNotify) wl_data_offer_destroy);
+  g_clear_pointer (&seat->pending_offer, wl_data_offer_destroy);
   seat->pending_source_actions = 0;
   seat->pending_action = 0;
 }
index 6876bd1e953ed9ce290f8400d7815e0eae338f79..b163a17139cd9253a1c5d4eba6439cdb5857e9ac 100644 (file)
@@ -78,8 +78,8 @@ gdk_wayland_drag_finalize (GObject *object)
 
   gdk_drag_set_cursor (drag, NULL);
 
-  g_clear_pointer (&wayland_drag->data_source, (GDestroyNotify) wl_data_source_destroy);
-  g_clear_pointer (&wayland_drag->offer, (GDestroyNotify) wl_data_offer_destroy);
+  g_clear_pointer (&wayland_drag->data_source, wl_data_source_destroy);
+  g_clear_pointer (&wayland_drag->offer, wl_data_offer_destroy);
 
   dnd_surface = wayland_drag->dnd_surface;
 
index 1c21dafdfa29fb00db20f3ad90f4efdb6ae44121..a0a02a33b41d04cf69a0bddaa1a5c82a326fc046 100644 (file)
@@ -69,7 +69,7 @@ gdk_wayland_drop_finalize (GObject *object)
 {
   GdkWaylandDrop *wayland_drop = GDK_WAYLAND_DROP (object);
 
-  g_clear_pointer (&wayland_drop->offer, (GDestroyNotify) wl_data_offer_destroy);
+  g_clear_pointer (&wayland_drop->offer, wl_data_offer_destroy);
 
   G_OBJECT_CLASS (gdk_wayland_drop_parent_class)->finalize (object);
 }
index 62a6941db2f3e6449cfbdf073fa6fd4590ba8084..98f75edc1f872efb4185d1860e4171eb5550ad7e 100644 (file)
@@ -62,20 +62,20 @@ gdk_wayland_primary_discard_pending (GdkWaylandPrimary *cb)
       gdk_content_formats_unref (ignore);
       cb->pending_builder = NULL;
     }
-  g_clear_pointer (&cb->pending, (GDestroyNotify) gtk_primary_selection_offer_destroy);
+  g_clear_pointer (&cb->pending, gtk_primary_selection_offer_destroy);
 }
 
 static void
 gdk_wayland_primary_discard_offer (GdkWaylandPrimary *cb)
 {
   g_clear_pointer (&cb->offer_formats, gdk_content_formats_unref);
-  g_clear_pointer (&cb->offer, (GDestroyNotify) gtk_primary_selection_offer_destroy);
+  g_clear_pointer (&cb->offer, gtk_primary_selection_offer_destroy);
 }
 
 static void
 gdk_wayland_primary_discard_source (GdkWaylandPrimary *cb)
 {
-  g_clear_pointer (&cb->source, (GDestroyNotify) wl_data_source_destroy);
+  g_clear_pointer (&cb->source, gtk_primary_selection_source_destroy);
 }
 
 static void
index 25cc9e659df4bb5b826748fe900d1395e8f98db5..1d70e56c869845c5350daf580ffa13446da61a58 100644 (file)
@@ -847,7 +847,7 @@ gtk_drag_content_finalize (GObject *object)
   GtkDragContent *content = GTK_DRAG_CONTENT (object);
 
   g_clear_object (&content->widget);
-  g_clear_pointer (&content->formats, (GDestroyNotify) gdk_content_formats_unref);
+  g_clear_pointer (&content->formats, gdk_content_formats_unref);
 
   G_OBJECT_CLASS (gtk_drag_content_parent_class)->finalize (object);
 }
index 4c502846ae0780905f195875721eeec95611736c..28490424665d373b3e29182e7699275bf01302b9 100644 (file)
@@ -3253,7 +3253,7 @@ scrolled_window_deceleration_cb (GtkWidget         *widget,
       gtk_adjustment_set_value (hadjustment, position);
     }
   else if (data->hscrolling)
-    g_clear_pointer (&data->hscrolling, (GDestroyNotify) gtk_kinetic_scrolling_free);
+    g_clear_pointer (&data->hscrolling, gtk_kinetic_scrolling_free);
 
   if (data->vscrolling &&
       gtk_kinetic_scrolling_tick (data->vscrolling, elapsed, &position))
@@ -3262,7 +3262,7 @@ scrolled_window_deceleration_cb (GtkWidget         *widget,
       gtk_adjustment_set_value (vadjustment, position);
     }
   else if (data->vscrolling)
-    g_clear_pointer (&data->vscrolling, (GDestroyNotify) gtk_kinetic_scrolling_free);
+    g_clear_pointer (&data->vscrolling, gtk_kinetic_scrolling_free);
 
   if (!data->hscrolling && !data->vscrolling)
     {